﻿using System;
using System.Collections.Generic;
using Citi.PTSConsolidation.SchedulerUI.Bases;
using Citi.RoutineBase;

namespace Citi.PTSConsolidation.SchedulerUI
{
    public class ApplicationPreviousYearReportGeneration : ReportPreviousYear
    {
        public new IEnumerable<RoutineParameter> Parameters
        {
            get
            {
                return new List<RoutineParameter> { 
                    new RoutineParameter{ Description = "Finish Month to generate Previous Year Report", Name ="FinishMonth", Nullable= true, Required = false, Type = typeof(int)},
                    new RoutineParameter{ Description = "Email to send when some error occurs. Separated by Semicolons(;).", Name ="EmailAddressError", Nullable= false, Required = true, Type = typeof(string)},
                    new RoutineParameter{ Description = "Users that must receive email when the reports are available. Separated by Semicolons(;).", Name ="EmailAddressUsers", Nullable = false, Required = true, Type = typeof(string)},
                    new RoutineParameter{ Description = "Do you want to generate only BZTE Programs?", Name ="BZTEPrograms", Nullable = true, Required = false, Type = typeof(bool)}
                };
            }
        }

        protected override void ExecuteProcess(DateTime referenceDate, ref ICurrentAction currentAction, string networkUser, string networkPassword, Dictionary<string, object> parameters)
        {
            ReportGenerationHelper.GenerateApplicationReportYear(referenceDate.Year - 1, ref currentAction, parameters, referenceDate, "Previous Year");
        }
    }

    public class ApplicationCurrentYearReportGeneration : ReportCurrentYear
    {
        public new IEnumerable<RoutineParameter> Parameters
        {
            get
            {
                return new List<RoutineParameter> { 
                    new RoutineParameter{ Description = "Email to send when some error occurs. Separated by Semicolons(;).", Name ="EmailAddressError", Nullable= false, Required = true, Type = typeof(string)},
                    new RoutineParameter{ Description = "Users that must receive email when the reports are available. Separated by Semicolons(;).", Name ="EmailAddressUsers", Nullable = false, Required = true, Type = typeof(string)},
                    new RoutineParameter{ Description = "Do you want to generate only BZTE Programs?", Name ="BZTEPrograms", Nullable = true, Required = false, Type = typeof(bool)}
                };
            }
        }

        protected override void ExecuteProcess(DateTime referenceDate, ref ICurrentAction currentAction, string networkUser, string networkPassword, Dictionary<string, object> parameters)
        {
            ReportGenerationHelper.GenerateApplicationReportYear(referenceDate.Year, ref currentAction, parameters, referenceDate, "Current Year");
        }
    }

    public class ApplicationNextYearReportGeneration : ReportNextYear
    {
        public new IEnumerable<RoutineParameter> Parameters
        {
            get
            {
                return new List<RoutineParameter> { 
                    new RoutineParameter{ Description = "Start Month to generate Next Year Report", Name ="StartMonth", Nullable= true, Required = false, Type = typeof(int)},
                    new RoutineParameter{ Description = "Email to send when some error occurs. Separated by Semicolons(;).", Name ="EmailAddressError", Nullable= false, Required = true, Type = typeof(string)},
                    new RoutineParameter{ Description = "Users that must receive email when the reports are available. Separated by Semicolons(;).", Name ="EmailAddressUsers", Nullable = false, Required = true, Type = typeof(string)},
                    new RoutineParameter{ Description = "Do you want to generate only BZTE Programs?", Name ="BZTEPrograms", Nullable = true, Required = false, Type = typeof(bool)}
                };
            }
        }

        protected override void ExecuteProcess(DateTime referenceDate, ref ICurrentAction currentAction, string networkUser, string networkPassword, Dictionary<string, object> parameters)
        {
            ReportGenerationHelper.GenerateApplicationReportYear(referenceDate.Year + 1, ref currentAction, parameters, referenceDate, "Next Year");
        }
    }
}
